$(function () {
    var layer = layui.layer;
    form = layui.form;
    form.verify({
        same: function (value) {
            var uname = $('.layui-form input[name=password]').val()
            if (value !== uname) {
                return '两次输入的密码不一样'
            }
        }
    })
    $(".layui-form").on("submit", function (ev) {
        ev.preventDefault();
        let fd = $(this).serialize();
        axios({
            url: "http://localhost:8888/admin/users",
            method: "POST",
            data: fd,
            headers: {
                Authorization: sessionStorage.getItem('mytoken')
            }
        }).then(function (res) {
            layer.msg("添加成功")
        })
        $("input").val("")
    })
})